/**
 * @param {number[][]} dimensions
 * @return {number}
 */
var areaOfMaxDiagonal = function(dimensions) {
    let height =  dimensions[0][0], width = dimensions[0][1]
    let area = height * width
    let line = Math.sqrt(width * width + height * height)
    for(let i = 1; i < dimensions.length; i++) {
        if(Math.sqrt(dimensions[i][0] * dimensions[i][0] + dimensions[i][1] * dimensions[i][1]) > line) {
            line = Math.sqrt(dimensions[i][0] * dimensions[i][0] + dimensions[i][1] * dimensions[i][1])
            area = dimensions[i][0] * dimensions[i][1]
        } else if(Math.sqrt(dimensions[i][0] * dimensions[i][0] + dimensions[i][1] * dimensions[i][1]) == line) {
            if(dimensions[i][0] * dimensions[i][1] > area) {
                area = dimensions[i][0] * dimensions[i][1]
            }
        }
    }
    return area
};
console.log(areaOfMaxDiagonal([[9,3],[8,6]]));
console.log(areaOfMaxDiagonal([[3,4],[4,3]]));